clear all
use "JED_Vietnam_PublicOpinion.dta"

* Table 2 (NO2 & Air Quality Perception) 

eststo clear
eststo: regress air_quality z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress air_quality_past z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality_past z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress mask z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress mask z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "Table2A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 highschool female age income_high income_middle) order (z_no2 highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Table 2 (Coal Plants & Air Quality Perception) 

eststo clear
eststo: regress air_quality z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress air_quality_past z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality_past z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress mask z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress mask z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "Table2B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight highschool female age income_high income_middle) order (z_sum_weight highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")
	
* Table 3 (NO2 & Opposition to Coal Plants)

eststo clear
eststo: regress opposition_coal z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress opposition_coal z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "Table3A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 highschool female age income_high income_middle) order (z_no2 highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Table 3 (Coal Plants & Opposition to Coal Plants)

eststo clear
eststo: regress opposition_coal z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress opposition_coal z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "Table3B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight highschool female age income_high income_middle) order (z_sum_weight highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Table 4 (NO2 & Satisfaction with Government)

eststo clear
eststo: regress gov_satisfaction z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress gov_satisfaction z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress region_satisfaction z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress region_satisfaction z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress assembly_satisfaction z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress assembly_satisfaction z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "Table4A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 highschool female age income_high income_middle) order (z_no2 highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Table 4 (Coal Plants & Satisfaction with Government)

eststo clear
eststo: regress gov_satisfaction z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress gov_satisfaction z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress region_satisfaction z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress region_satisfaction z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress assembly_satisfaction z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress assembly_satisfaction z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "Table4B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight highschool female age income_high income_middle) order (z_sum_weight highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A1 (Summary Statistics)

eststo clear
estpost summarize air_quality air_quality_past mask opposition_coal gov_satisfaction region_satisfaction assembly_satisfaction no2 sum_weight highschool female age income_high income_middle
esttab using "AppendixTableA1.tex", cells("count mean(fmt(2)) sd(fmt(2)) min(fmt(2)) max(fmt(2))") nomtitle nonumber label replace b(3)

* Appendix Table A2 (Correlation Coefficients)

eststo clear
estpost correlate air_quality air_quality_past mask opposition_coal gov_satisfaction region_satisfaction assembly_satisfaction no2 sum_weight highschool female age income_high income_middle, matrix listwise
esttab using "AppendixTableA2.tex", unstack not noobs compress label replace b(2) nostar

* Appendix Table A4 (Probit: NO2 & Air Quality Perception)

eststo clear
eststo: oprobit air_quality z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: oprobit air_quality z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: oprobit air_quality_past z_no2 highschool female age income_high income_middle [aw=weight_respondent] 
eststo: oprobit air_quality_past z_no2 highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: probit mask z_no2 highschool female age income_high income_middle [iw=weight_respondent] 
eststo: probit mask z_no2 highschool female age income_high income_middle i.region_id [iw=weight_respondent] 

esttab using "AppendixTableA4_A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 highschool female age income_high income_middle) order (z_no2 highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A4 (Probit: Coal Plants & Air Quality Perception)

eststo clear
eststo: oprobit air_quality z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: oprobit air_quality z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: oprobit air_quality_past z_sum_weight highschool female age income_high income_middle [aw=weight_respondent] 
eststo: oprobit air_quality_past z_sum_weight highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: probit mask z_sum_weight highschool female age income_high income_middle [iw=weight_respondent] 
eststo: probit mask z_sum_weight highschool female age income_high income_middle i.region_id [iw=weight_respondent] 

esttab using "AppendixTableA4_B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight highschool female age income_high income_middle) order (z_sum_weight highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")
	
* Appendix Table A5 (Probit: NO2 & Opposition to Coal Plants)

eststo clear
eststo: probit opposition_coal z_no2 highschool female age income_high income_middle [iw=weight_respondent] 
eststo: probit opposition_coal z_no2 highschool female age income_high income_middle i.region_id [iw=weight_respondent] 

esttab using "AppendixTableA5_A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 highschool female age income_high income_middle) order (z_no2 highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")
	
* Appendix Table A5 (Probit: Coal Plants & Opposition to Coal Plants)

eststo clear
eststo: probit opposition_coal z_sum_weight highschool female age income_high income_middle [iw=weight_respondent] 
eststo: probit opposition_coal z_sum_weight highschool female age income_high income_middle i.region_id [iw=weight_respondent] 

esttab using "AppendixTableA5_B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight highschool female age income_high income_middle) order (z_sum_weight highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A6 (NO2 & Air Quality Perception, Education as Six Categories)
	
local education_level = "education_primary education_secondary highschool_only college post_graduate"

eststo clear
eststo: regress air_quality z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress air_quality_past z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality_past z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress mask z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress mask z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA6_A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 `education_level' female age income_high income_middle) order (z_no2 `education_level' female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A6 (Coal Plants & Air Quality Perception, Education as Six Categories)

local education_level = "education_primary education_secondary highschool_only college post_graduate"

eststo clear
eststo: regress air_quality z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress air_quality_past z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress air_quality_past z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress mask z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress mask z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA6_B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight `education_level' female age income_high income_middle) order (z_sum_weight `education_level' female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")
		
* Appendix Table A7 (NO2 & Opposition to Coal Plants, Education as Six Categories)

local education_level = "education_primary education_secondary highschool_only college post_graduate"

eststo clear
eststo: regress opposition_coal z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress opposition_coal z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA7_A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 `education_level' female age income_high income_middle) order (z_no2 `education_level' female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A7 (Coal Plants & Opposition to Coal Plants, Education as Six Categories)

local education_level = "education_primary education_secondary highschool_only college post_graduate"

eststo clear
eststo: regress opposition_coal z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress opposition_coal z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA7_B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight `education_level' female age income_high income_middle) order (z_sum_weight `education_level' female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A8 (NO2 & Satisfaction with Government, Education as Six Categories)

local education_level = "education_primary education_secondary highschool_only college post_graduate"

eststo clear
eststo: regress gov_satisfaction z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress gov_satisfaction z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress region_satisfaction z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress region_satisfaction z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress assembly_satisfaction z_no2 `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress assembly_satisfaction z_no2 `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA8_A.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_no2 `education_level' female age income_high income_middle) order (z_no2 `education_level' female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A8 (Coal Plants & Satisfaction with Government, Education as Six Categories)

local education_level = "education_primary education_secondary highschool_only college post_graduate"

eststo clear
eststo: regress gov_satisfaction z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress gov_satisfaction z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress region_satisfaction z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress region_satisfaction z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress assembly_satisfaction z_sum_weight `education_level' female age income_high income_middle [aw=weight_respondent] 
eststo: regress assembly_satisfaction z_sum_weight `education_level' female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA8_B.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_sum_weight `education_level' female age income_high income_middle) order (z_sum_weight `education_level' female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")

* Appendix Table A9 (Distance to Plants & Air Quality Perception)

eststo clear
eststo: oprobit air_quality z_disttoplant highschool female age income_high income_middle [aw=weight_respondent] 
eststo: oprobit air_quality z_disttoplant highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: oprobit air_quality_past z_disttoplant highschool female age income_high income_middle [aw=weight_respondent] 
eststo: oprobit air_quality_past z_disttoplant highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: probit mask z_disttoplant highschool female age income_high income_middle [iw=weight_respondent] 
eststo: probit mask z_disttoplant highschool female age income_high income_middle i.region_id [iw=weight_respondent] 

esttab using "AppendixTableA9.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_disttoplant highschool female age income_high income_middle) order (z_disttoplant highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")	

* Appendix Table A10 (Distance to Plants & Opposition to Coal Plants)
	
eststo clear
eststo: regress opposition_coal z_disttoplant highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress opposition_coal z_disttoplant highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA10.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_disttoplant highschool female age income_high income_middle) order (z_disttoplant highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")
		
* Appendix Table A11 (Distance to Plants & Opposition to Coal Plants)

eststo clear
eststo: regress gov_satisfaction z_disttoplant highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress gov_satisfaction z_disttoplant highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress region_satisfaction z_disttoplant highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress region_satisfaction z_disttoplant highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

eststo: regress assembly_satisfaction z_disttoplant highschool female age income_high income_middle [aw=weight_respondent] 
eststo: regress assembly_satisfaction z_disttoplant highschool female age income_high income_middle i.region_id [aw=weight_respondent] 

esttab using "AppendixTableA11.tex", replace f booktabs b(3) se(3) eqlabels(none) alignment(C C) collabels(none) mtitles ("" "" "" "" "" "") keep(z_disttoplant highschool female age income_high income_middle) order (z_disttoplant highschool female age income_high income_middle) nogaps nonotes nonum nodepvars cells("b(fmt(3)star)" "se(fmt(3)par)") label addnotes("\textit{*p < 0.10, ** p < 0.05, *** p < 0.01}")
